#pragma once
#ifndef HZ_APPLICATION_HPP
#define HZ_APPLICATION_HPP
#include "core.h"
#include "Window.h"
#include "LayerStack.h"
#include "event/event.h"
#include "event/ApplicationEvent.h"
#include "imgui/ImguiLayer.h"
#include "Core/Timestep.h"

namespace Hazel
{

    class Application
    {
    public:
        Application(const std::string& name= "Hazel App");
        virtual ~Application() {}

        void run();
        void OnEvent(Event &e);

        void PushLayer(Layer *layer);
        void PushOverlay(Layer *overlay);

        void Close();
        
        inline static Application &Get() { return *s_Instance; }
        inline Window &GetWindow() { return *m_Window; }

    private:
        bool OnWindowClose(WindowCloseEvent &e);
        bool OnWindowResize(WindowResizeEvent &e);

    private:
        Hazel::Scope<Window> m_Window;
        ImguiLayer *m_ImguiLayer;
        bool m_Runing = true;
        bool m_Minimized = false;

        LayerStack m_layerstack;
        static Application *s_Instance;

        Timestep m_Timestep;
        float m_LastFrameTime = 0.0f;
        // unsigned int m_VertexArray;
    };

    // to be defined in client
    Application *create_application();
} // namespace Hazel
#endif // !HZ_APPLICATION_HPP
